package club.banyuan;

public class Truck extends Vehicle {
    //载货量
    private double capacity;

    public double getCapacity() {
        return capacity;
    }

    public void setCapacity(double capacity) {
        this.capacity = capacity;
    }

    public Truck(int year, String factory, boolean isRent, double capacity) {
        super(year, factory, isRent);
        this.capacity = capacity;
    }

    @Override
    public String toString() {
        if (this.isRent())
            return this.getYear() + "年" + this.getFactory() + "货车，载货量" + capacity + "吨,已出租。";
        else {
            return this.getYear() + "年" + this.getFactory() + "货车，载货量" + capacity + "吨,未出租。";
        }
    }
}
